package cn.edu.zzu.demo01Thread;

public class TestPriorityThread08 implements Runnable {

    public static void main(String[] args) {

        Thread a1 = new Thread(new TestPriorityThread08(), "a");
        Thread a2 = new Thread(new TestPriorityThread08(), "b");
        Thread a3 = new Thread(new TestPriorityThread08(), "c");
        Thread a4 = new Thread(new TestPriorityThread08(), "d");
        Thread a5 = new Thread(new TestPriorityThread08(), "e");

        //先设置优先级 ，在启动线程
        a1.setPriority(Thread.MIN_PRIORITY);
        a2.setPriority(3);
        a3.setPriority(Thread.NORM_PRIORITY);
        a4.setPriority(7);
        a5.setPriority(Thread.MAX_PRIORITY);

        a1.start();
        a2.start();
        a3.start();
        a4.start();
        a5.start();

        System.out.println(Thread.currentThread().getName() + "==" + Thread.currentThread().getPriority());

    }

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName() + "==" + Thread.currentThread().getPriority());
    }
}
